﻿using IO.Swagger.Model;
using MyCode.Project.Domain.Businesses;
using MyCode.Project.Domain.Dtos.Common;
using MyCode.Project.Domain.Model;
using MyCode.Project.Domain.Procs;
using System;
using System.Collections.Generic;

namespace MyCode.Project.Services
{
    /// <summary>
    /// 通用模块 相关服务
    /// </summary>
    public interface ICommonService
    {
        /// <summary>
        /// 获取流水编码，前缀使用<see cref="LxmConst.SerialCode"/>常量
        /// </summary>
        /// <param name="prefix">前缀</param>
        /// <returns></returns>
        string GetSerialCode(string prefix);

        /// <summary>
        /// 获取流水编码，前缀使用<see cref="LxmConst.SerialCode"/>常量
        /// </summary>
        /// <param name="prefix">前缀</param>
        /// <param name="shopId">店铺ID</param>
        /// <returns></returns>
        string GetSerialCode(string prefix, Guid shopId);

        /// <summary>
        /// 获取店员编码
        /// </summary>
        /// <returns></returns>
        string GetClerkCode();

        /// <summary>
        /// 获取支付流水号
        /// </summary>
        /// <param name="paySupply">1 招商银行支付  2 富友支付</param>
        /// <returns></returns>
        string GetPaySerialCode(int paySupply = 2);

        /// <summary>
        /// 业务单据从临时表转换到正式表
        /// </summary>
        /// <param name="proc">临时表转正式表</param>
        void TempTableToOfficialTabel(ProcTemp2Official proc);


        /// <summary>
        /// 执行存储过程 - 业务单据从临时表转换到正式表，并标记0表为已删除状态
        /// </summary>
        /// <param name="proc">临时表转正式表</param>
        void ProcTempTableToOfficialTableForSalesSheet(ProcTemp2Official proc);


        /// <summary>
        /// 获取空白国际码列表
        /// </summary>
        /// <param name="qty">获取数量</param>
        /// <param name="merchantId">商家ID</param>
        /// <returns></returns>
        List<BarcodeDto> GetBlankBarcodeList(int qty, Guid merchantId);

        /// <summary>
        /// 获取区域详情地址
        /// </summary>
        /// <param name="state">省份</param>
        /// <param name="city">城市</param>
        /// <param name="district">区域</param>
        /// <param name="address">详细地址</param>
        /// <returns></returns>
        string GetRegionAddress(Guid? state, Guid? city, Guid? district, string address = "");

        /// <summary>
        /// 处理区域详细地址
        /// </summary>
        /// <param name="list">区域数据传输对象</param>
        void HandlerRegionAddress<T>(List<T> list) where T : IRegionDto;

        /// <summary>
        /// 获取数据配置
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <param name="code">编码</param>
        /// <param name="merchantId">商家ID</param>
        /// <returns></returns>
        T GetDataConfig<T>(string code, Guid merchantId);

        /// <summary>
        /// 创建条码
        /// </summary>
        /// <param name="content">内容</param>
        /// <returns></returns>
        string CreateBarcode(string content);

        /// <summary>
        /// 创建二维码
        /// </summary>
        /// <param name="content">内容</param>
        /// <returns></returns>
        string CreateQrCode(string content);

        /// <summary>
        /// 获取当前星期几 返回字符串
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        string Getweek(int value);

        /// <summary>
        /// 计算两点位置的距离，返回两点的距离，单位 米
        /// 该公式为GOOGLE提供，误差小于0.2米
        /// </summary>
        /// <param name="lng1">第一点经度</param>
        /// <param name="lat1">第一点纬度</param>
        /// <param name="lng2">第二点经度</param>
        /// <param name="lat2">第二点纬度</param>
        /// <returns></returns>
         double GetDistance(double lng1, double lat1, double lng2, double lat2);

        /// <summary>
        /// 计算订单明细的分摊单价的公共方法
        /// </summary>
        /// <param name="sheetItem">订单明细</param>
        /// <param name="totalAmount">订单含余额支付的总金额</param>
        /// <param name="cashAmount">订单不含余额支付的总金额</param>
        /// <returns></returns>
        List<BusSalesSheetItem> GetCalPriceAndRevenuePrice(List<BusSalesSheetItem> sheetItem, decimal totalAmount, decimal? cashAmount);

    }
}
